Count Property (AddressLists Collection) 

The Count property returns the number of AddressList objects in the collection. Read-only.

Syntax

objAddrListsColl.Count

Data Type

Long

Example

This code fragment uses the Count and ItemJGP36R properties to determine how many AddressList objects are available in the collection:

Dim i As Integer ' loop counter

Set hierarchy = MAPI.Session.AddressLists

' make sure returned collection object is valid

If hierarchy Is Nothing Then

    ' Exit "Address book hierarchy is invalid"

End If

' see if hierarchy is empty

i = hierarchy.Count ' count of address books in hierarchy

If 0 = i Then

    ' Exit "No available address books"

End If

' precautionary loop to make sure address books are all valid

For i = 1 To hierarchy.Count Step 1

    If Nothing = hierarchy.Item(i) Then

    ' Exit "Address book is invalid"

    End If

Next i